//
//  STBottomLineView.m
//  赛拓
//
//  Created by 王磊 on 7/30/16.
//  Copyright © 2016 立金所. All rights reserved.
//

#import "STBottomLineView.h"
@interface STBottomLineView()
@property (nonatomic ,strong) UILabel *titleLabel;

@property (nonatomic ,strong) UIView *bottomLine;


@property (nonatomic ,strong) UIImageView *bgImageView;

@end
@implementation STBottomLineView

- (void)commitInit {
    [super commitInit];
    
    self.alignment = NSTextAlignmentLeft;
    
    self.textColor = ST_NAVI_COLOR;
    
    self.font = ST_15_FONT;
    
    UIImageView *bgImageView = [[UIImageView alloc]init];
    
    self.bgImageView = bgImageView;
    
    [self addSubview:bgImageView];
    
    UILabel *titleLabel = [[UILabel alloc]init];
    
    self.titleLabel = titleLabel;
    
    [self addSubview:titleLabel];
    
    //    UIView *bottomLine = [[UIView alloc]init];
    //
    //    self.bottomLine = bottomLine;
    //
    //    bottomLine.backgroundColor = ST_999999_COLOR;
    //
    //    [self addSubview:bottomLine];
    
}
- (void)updateData:(id)data {
    
    self.titleLabel.text = data;
    
    self.bgImageView.image = [UIImage imageNamed:@"商品标题背景"];
}
- (void)setAlignment:(NSTextAlignment)alignment {
    _alignment = alignment;
    
    self.titleLabel.textAlignment = alignment;
    
}

- (void)setFont:(UIFont *)font {
    _font = font;
    
    self.titleLabel.font = font;
}
- (void)setTextColor:(UIColor *)textColor {
    _textColor = textColor;
    
    self.titleLabel.textColor = textColor;
}
- (void)setAttributedText:(NSAttributedString *)attributedText {
    _attributedText = attributedText;
    
    self.titleLabel.attributedText = attributedText;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    CGFloat margin = 20 * ST_RATE;
    
    self.titleLabel.frame = CGRectMake(margin, 0, self.k_width - margin * 2, self.k_height);
    
    self.bottomLine.frame = CGRectMake(0, self.k_height - 0.5, self.k_width, 0.5);
    
    self.bgImageView.frame = self.bounds;
}
@end
